<%--
  Created by IntelliJ IDEA.
  User: CHENHANJIE
  Date: 2020/11/23
  Time: 23:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isErrorPage="true" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
    String path = request.getContextPath();
    System.out.println(request.getAttribute("trainee"));
%>
<html>
<head>
    <title>Title</title>
    <link href="bootstrap-3.3.7-dist/js/bootstrap.js">
</head>
<body>
<form method="post" action="<%=path%>/chj<%--/chj?action=querybylike--%>" id="listform">
    <li>搜索：</li>
    <li>
        <input type="text" placeholder="请输入搜索关键字" name="keywords" class="input">
        <input type="submit" value="搜索">
    </li>
</form>
<table border="1px">
    <c:forEach items="${requestScope.trainee}" var="t">
        <tr>
            <td style="text-align: left; padding-left:20px">
                <c:out value="${t.id}"></c:out>

            </td>
            <td style="text-align: left; padding-left:20px">
                <c:out value="${t.name}"/>
            </td>
            <td style="text-align: left; padding-left:20px">
                <c:out value="${t.sex}"/>
            </td>
            <td style="text-align: left; padding-left:20px">
                <c:out value="${t.age}"/>
            </td>
            <td style="text-align: left; padding-left:20px">
                <c:out value="${t.school}"/>
            </td>
            <td style="text-align: left; padding-left:20px">
                <c:out value="${t.sno}"/>
            </td>
            <td style="text-align: left; padding-left:20px">
                <c:out value="${t.phone}"/>
            </td>
            <td style="text-align: left; padding-left:20px">
                <c:out value="${t.email}"/>
            </td>
            <td style="text-align: left; padding-left:20px">
                <c:out value="${t.status}"/>
            </td>
            <td style="text-align: left; padding-left:20px">
                <c:out value="${t.beginTime}"/>
            </td>
            <td style="text-align: left; padding-left:20px">
                <c:out value="${t.endTime}"/>
            </td>
        </tr>

    </c:forEach>
</table>


<hr>
<div style="float: left">
    <nav>
        <ul class="pagination">
            <%-- 判断是否是第一页--%>
            <c:if test="${pageBean.currentPage==1}">
            <li class="disabled">
                </c:if>
                <c:if test="${pageBean.currentPage!=1}">
            <li>
                </c:if>
                <a href="${pageContext.request.contextPath}/findUserByPageServlet?currentPage=${pageBean.currentPage-1}&rows=5"
                   aria-label="Previous">
                    <span aria-hidden="true">&laquo;</span>
                </a>
            </li>
            <c:forEach var="i" varStatus="s" step="1" begin="1" end="${pageBean.totalPage}">
                <c:if test="${pageBean.currentPage == i}">
                    <li class="active">

                        <a href="${pageContext.request.contextPath}/findUserByPageServlet?currentPage=${i}&rows=5"

                           name="li">${i}</a></li>
                </c:if>
                <c:if test="${pageBean.currentPage != i}">
                    <li>
                        <a href="${pageContext.request.contextPath}/findUserByPageServlet?currentPage=${i}&rows=5"
                           name="li">${i}</a></li>
                </c:if>
            </c:forEach>
            <%-- 判断是否是最后页--%>
            <c:if test="${pageBean.currentPage >= pageBean.totalPage}">
            <li class="disabled">
                </c:if>
                <c:if test="${pageBean.currentPage!=pageBean.totalPage}">
            <li>
                </c:if>
                <a href="${pageContext.request.contextPath}/findUserByPageServlet?currentPage=${pageBean.currentPage+1}&rows=5"
                   aria-label="Next">
                    <span aria-hidden="true">&raquo;</span>
                </a>
            </li>
            <span style="font-size: 25px ;margin-left: 5px">共${pageBean.totalCount}条数据，共${pageBean.totalPage}页</span>
        </ul>
    </nav>
</div>

</body>
</html>
